<template>
  <div>
    <div class="layui-col-sm12 layui-col-md24">
      <div class="blog-card shadow">
        <div class="blog-card-title">推荐阅读</div>
        <ul class="blog-card-ul">
          <li v-for="(item,index) in data" :key="index">
            <span class="layui-badge  ">荐</span>
            <router-link :to="'/news/newsdetail?id='+item.id" :title="item.title">{{item.title}}</router-link>
      
          </li>

        </ul>
      </div>
    </div>
  </div>
</template>
<script lang="ts">
export default {
    name:'randomnew'

}
</script>
<script lang="ts" setup>
import {ref} from 'vue';
import http from 'webosutils/lib/http';
import { useAppStore } from '../../store/app';
const appStore = useAppStore();
const data=ref([]) as any;

const GetRandomNew=()=>{
  if(appStore.newdata.length==0){
       http.post( "/v1/api/portalsite/GetRandomNew", {}).then(res => {
        data.value = Object.freeze( res.data);
        appStore.newdata = data.value;

        }).catch(res => {
         

        });
      }else{
        data.value = appStore.newdata;
      }
}
GetRandomNew();
</script>